fix: avoid to use visit wrapper for __visit_globals#2934
Closed
HerrCai0907 wants to merge 2 commits intoAssemblyScript:mainfrom
Closed
fix: avoid to use visit wrapper for __visit_globals#2934HerrCai0907 wants to merge 2 commits intoAssemblyScript:mainfrom
HerrCai0907 wants to merge 2 commits intoAssemblyScript:mainfrom
Conversation
CountBleck
reviewed
Jul 10, 2025
| if (this.runtimeFeatures & RuntimeFeatures.Rtti) compileRTTI(this); | ||
| if (this.runtimeFeatures & RuntimeFeatures.visitGlobals) compileVisitGlobals(this); | ||
| if (this.runtimeFeatures & RuntimeFeatures.visitMembers) compileVisitMembers(this); | ||
| if (this.runtimeFeatures & RuntimeFeatures.visitGlobals) compileVisitGlobals(this); |
Member
There was a problem hiding this comment.
I'm guessing this is done so the classReference.visitRef != 0 check in getVisitInstanceName doesn't erroneously evaluate to false (due to ensureVisitMembersOf not being called before compileVisitGlobals if you didn't reorder these two lines).
In that case, maybe add a comment here or in getVisitInstanceName explaining why compileVisitMembers has to be called before compileVisitGlobals...after all, it took me a few minutes of thinking/code searching to make sure that the classReference.visitRef check is safe, and that led me back to this diff.
If a class is annotated as final, it is impossible to have dynamic dispatch for __visit. So we can call the class's __visit function directly. For string, we can even save the call
8a06d97 to
d21dcfd
Compare
Member
Author
|
I found it is wrong. even global marked as const, it is also possible to be initialized during ~start and point to heap dyn allocated memory. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a class is annotated as final, it is impossible to have dynamic dispatch for __visit. So we can call the class's __visit function directly.
For pointee free object, we can even save the call